<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      let company = {
        sales: [
          { name: "John", salary: 1000 },
          { name: "Alice", salary: 1600 },
        ],
        development: {
          sites: [
            {
              name: "Peter",
              salary: 2000,
            },
            {
              name: "Alex",
              salary: 1800,
            },
          ],
          internals: [
            {
              name: "Jack",
              salary: 1300,
            },
          ],
        },
      };

      function mapObj(obj) {
        Object.entries(obj).forEach((el) => {
          if (Array.isArray(el[1])) {
            el[1].forEach((u) => console.log(u));
          } else {
            mapObj(el[1]);
          }
        });
      }

      mapObj(company);
    </script>
  </body>
</html>
